Skip to content

fix(deps): replace through2 with built-in stream.Transform - #411

Open
v1rtl wants to merge 1 commit into
ionic-team:developfrom
v1rtl:chore/remove-through2
Open

v1rtl wants to merge 1 commit into
ionic-team:developfrom
v1rtl:chore/remove-through2

Conversation

@v1rtl

@v1rtl v1rtl commented Nov 10, 2026

Copy link
Copy Markdown

through2 is only used for the three line-parsing transforms in src/android/utils/adb.ts and src/android/utils/emulator.ts. through2(fn) is just new Transform() with _transform = fn, so this replaces it with new Transform({ transform: fn }) from Node's built-in stream module.

This removes 6 packages from production installs: through2, readable-stream, inherits, string_decoder, safe-buffer and util-deprecate.

Most of the diff is re-indentation; it's easier to review with whitespace hidden (?w=1).

Why this is not a breaking change

  • through2@4 depends on readable-stream@3, which is a copy of the stream implementation from Node 10. native-run requires Node >=16.0.0, whose built-in stream module is a newer version of the same code, so nothing that worked before relies on an API that's missing now.
  • The transforms are created with the same options as before: through2 passed {} to Transform, and the new code passes only transform. objectMode, highWaterMark and the encoding defaults are unchanged.
  • split2@4, which feeds these transforms, already uses the built-in stream, so the pipelines now use one stream implementation end to end.
  • No exported API, types or engines change.

Testing

  • npm run lint, npm run build and npm test pass.
  • Ran the three pipelines with through2 and with stream.Transform on Node 16.20.2 and 24: two sources into one parser (spawnEmulator, including one source ending before the other) and a single source (installApk, getAVDFromEmulator). Both delivered the same lines and the same stream events, with no errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant